<?php
/**
 * Created by PhpStorm.
 * User: Aliaksei Lazerka
 * Date: 10/22/14
 * Time: 11:07 PM
 */
include_once(dirname(__FILE__) . "/../functions/db_manipulate.php");

$fields = getProductFields($_POST['listRootId'], $_POST['sectionId']);

$action = "?aPH&sid=" . $_POST['sectionId'] . "&lr=" . $_POST['listRootId'] . "&ls=" . $_POST['subElemId'];

$output = "<form method='post' action='".$action."' id='addProductForm'>";

foreach ($fields as $key => $value) {
  $output .= $value[1] . ": " . DBTypes::generateInput($value[0], $key)."<br>";
}

$output .= "<br/>";
$output .= "<input type='button' value='Добавить' onclick='$(\"#addProductForm\").submit()'>";
$output .= "</form>";

echo $output;
